/*
========================================================================
 Name        : EasyPlayerAppUi.cpp
 Author      : Yupeng Song
 Copyright   : This is GUI hello world for Easy Symbian
 Description : 
========================================================================
*/

#include <eikmenub.h>
#include <akncontext.h>
#include <akntitle.h>
#include <EasyPlayer.rsg>

#include "EasyPlayerAppUi.h"
#include "EasyPlayer.hrh"
#include "EasyPlayerPlaybackView.h"

/**
 * Construct the CEasyPlayerAppUi instance
 */ 
CEasyPlayerAppUi::CEasyPlayerAppUi()
	{
	}

/** 
 * The appui's destructor removes the container from the control
 * stack and destroys it.
 */
CEasyPlayerAppUi::~CEasyPlayerAppUi()
	{
	}

void CEasyPlayerAppUi::InitializeContainersL()
	{
	iPlaybackView = CEasyPlayerPlaybackView::NewL();
	AddViewL( iPlaybackView );
	SetDefaultViewL( *iPlaybackView );
	}

/**
 * Handle a command for this appui (override)
 * @param aCommand command id to be handled
 */
void CEasyPlayerAppUi::HandleCommandL( TInt aCommand )
	{
	switch ( aCommand )
		{
		case EAknSoftkeyExit:
		case EEikCmdExit:
			Exit();
			break;
		default:
			break;
		}
	}

/** 
 * Override of the HandleResourceChangeL virtual function
 */
void CEasyPlayerAppUi::HandleResourceChangeL( TInt aType )
	{
	CAknViewAppUi::HandleResourceChangeL( aType );
	}
				
/** 
 * Override of the HandleKeyEventL virtual function
 * @return EKeyWasConsumed if event was handled, EKeyWasNotConsumed if not
 * @param aKeyEvent 
 * @param aType 
 */
TKeyResponse CEasyPlayerAppUi::HandleKeyEventL(
		const TKeyEvent& /* aKeyEvent */,
		TEventCode /* aType */ )
	{
	return EKeyWasNotConsumed;
	}

/** 
 * Override of the HandleViewDeactivation virtual function
 *
 * @param aViewIdToBeDeactivated 
 * @param aNewlyActivatedViewId 
 */
void CEasyPlayerAppUi::HandleViewDeactivation( 
		const TVwsViewId& aViewIdToBeDeactivated, 
		const TVwsViewId& aNewlyActivatedViewId )
	{
	CAknViewAppUi::HandleViewDeactivation( 
			aViewIdToBeDeactivated, 
			aNewlyActivatedViewId );
	}

/**
 * @brief Completes the second phase of Symbian object construction. 
 * Put initialization code that could leave here. 
 */ 
void CEasyPlayerAppUi::ConstructL()
	{
	
	BaseConstructL( EAknEnableSkin  | 
					 EAknEnableMSK ); 
	InitializeContainersL();
	
	}

